<template>
    <div>
        <div class="posts" v-for="(item, index) in postList" :key="index">
            <el-header>
                <el-avatar>
                    <img v-if="item.avatar!=''" :src="require('../../../../server/public/images/user/avata/' + item.authorAvata)" alt="">
                </el-avatar>
                <div class="post-title">
                    <p class="text-h2">{{item.author}}</p>
                    <span class="text1">{{item.ceatedAt}}</span>
                </div>
                <div class="tools">
                    <button class="text-a">关注</button>
                    <img src="@/assets/images/操作.png" alt="">
                </div>
            </el-header>
            <div>
                <p class="content">{{item.content}}</p>
                <div class="imgbox">
                    <el-image :preview-src-list="[require('../../../../server/public/images/class/' + item.img)]" :src="require('../../../../server/public/images/class/' + item.img)" ></el-image>
                </div>
            </div>
            <el-footer>
                <div>
                    <img src="@/assets/images/看过.png" alt=""><span>0</span>
                </div>
                <div>
                    <img src="@/assets/images/喜欢.png" alt=""><span>0</span>
                    <img src="@/assets/images/收藏.png" alt=""><span>0</span>
                    <img src="@/assets/images/评论.png" alt=""><span class="last">0</span>
                </div>
            </el-footer>
        </div>
    </div>
</template>

<script>

import { getPosts } from '@/api/community/posts'

export default {
    name: 'WorkspaceJsonCommunityCircle',

    data() {
        return {
            showimgpost: true,
            postList: [],
        };
    },

    created(){
        this.getPosts()
    },

    mounted() {
    },

    methods: {
        // 获取帖子列表
        getPosts(){
            const params = {
                articleId: this.articleId
            }
            getPosts(params).then((res)=>{
                this.postList = res.data
                // console.log(this.postList);
            }).catch((err)=>{
                console.log(err);
            })
        }
    },
};
</script>

<style scoped>

</style>